<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2025/5/4
  Time: 21:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.project.DB_Ticket" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<!DOCTYPE html>
<html>
<head>
    <title>编辑票务</title>
</head>
<body>
<h2>编辑票务</h2>
<%
    String id = request.getParameter("id");
    if (id != null) {
        DB_Ticket dbTicket = new DB_Ticket();
        List<String> findInput = new ArrayList<>();
        List<String> returnList = new ArrayList<>();
        findInput.add(id);
        dbTicket.find(findInput, returnList);

        if (!returnList.isEmpty()) {
            String oid = returnList.get(1);
            String uid = returnList.get(2);
            String set = returnList.get(3);
            String state = returnList.get(4);
%>
<form action="updateTicket.jsp" method="post">
    <input type="hidden" name="id" value="<%= id %>">
    <label for="oid">订单ID:</label>
    <input type="text" id="oid" name="oid" value="<%= oid %>" required><br>
    <label for="uid">用户ID:</label>
    <input type="text" id="uid" name="uid" value="<%= uid %>" required><br>
    <label for="set">座位:</label>
    <input type="text" id="set" name="set" value="<%= set %>" required><br>
    <label for="state">票务状态:</label>
    <input type="text" id="state" name="state" value="<%= state %>" required><br>
    <input type="submit" value="更新票务">
</form>
<%
        } else {
            out.println("未找到要编辑的票务");
        }
    } else {
        out.println("未获取到票务ID");
    }
%>
</body>
</html>
